//for use with A Little Bit of Knowledge replication data.dta (Stata 14)
//Available on Research & Politics' Harvard Dataverse site

//Code requires clarify package (https://gking.harvard.edu/files/clarify.pdf)


//differences in GMO knowledge of 3 answers included in news feed
ttest gmoknowledge_three,by(treatments) //0=news feed, 1=full article
ttest gmoknowledge_three,by(feedtreatment) //0=control, 1=news feed


//Code for Figure 3
//0=feed treatment, 1=full article treatment
//answers in neither condition
prtest gmostate_correct,by(treatments)
//answers in article condition only
prtest gmoparty_correct,by(treatments)
prtest gmoedu_correct,by(treatments)
//answers found in both conditions
prtest sciper_correct,by(treatments)
prtest pubper_correct,by(treatments)
prtest gmogroup_correct,by(treatments)

//0=control, 1 = feed
//answers in neither condition
prtest gmostate_correct,by(feedtreatment)
prtest gmoparty_correct,by(feedtreatment)
prtest gmoedu_correct,by(feedtreatment)
//answers in feed condition
prtest sciper_correct,by(feedtreatment)
prtest pubper_correct,by(feedtreatment)
prtest gmogroup_correct,by(feedtreatment)


//Code for Table 1
reg gmoknowledge full feed nfa full#c.nfa feed#c.nfa
reg gmoknowledge full feed nfa full#c.nfa feed#c.nfa age educ white party male income
reg overconfidence full feed nfa full#c.nfa feed#c.nfa
reg overconfidence full feed nfa full#c.nfa feed#c.nfa age educ white party male income


//Code for Figure 4
estsimp reg overconfidence full feed nfa nfafull nfafeed
//Control group predictions
//min NFA
setx feed 0 full 0 nfa min nfafull 0 nfafeed 0 
simqi, level (95)
//max NFA
setx feed 0 full 0 nfa max nfafull 0 nfafeed 0 
simqi, level (95)
//Feed treatment predictions
//min NFA
setx feed 1 full 0 nfa min nfafull 0 nfafeed min 
simqi, level (95)
//max NFA
setx feed 1 full 0 nfa max nfafull 0 nfafeed max
simqi, level (95)
//Full treatment predictions
//min NFA
setx feed 0 full 1 nfa min nfafull min nfafeed 0 
simqi, level (95)
//max NFA
setx feed 0 full 1 nfa max nfafull max nfafeed 0 
simqi, level (95)
drop b1 b2 b3 b4 b5 b6 b7
drop in 991/1000




//APPENDIX ANALYSES
//A1: Descriptive stats
sum age
tab male
tab white
tab party
tab educ
tab income


//A2: Balance Tests
ttest nfa,by(treatments)
ttest nfa,by(fulltreatment)
ttest nfa,by(feedtreatment)
ttest age,by(treatments)
ttest age,by(fulltreatment)
ttest age,by(feedtreatment)
ttest education,by(treatments)
ttest education,by(fulltreatment)
ttest education,by(feedtreatment)
prtest white,by(treatments)
prtest white,by(fulltreatment)
prtest white,by(feedtreatment)
ttest party,by(treatments)
ttest party,by(fulltreatment)
ttest party,by(feedtreatment)
prtest male,by(treatments)
prtest male,by(fulltreatment)
prtest male,by(feedtreatment)
ttest income,by(treatments)
ttest income,by(fulltreatment)
ttest income,by(feedtreatment)
logit full nfa age education white party male income
logit feed nfa age education white party male income
logit control nfa age education white party male income


//A7: Mean Scores by News Feed Post Selection
ttest gmoknowledge,by(chose_gmo)
ttest overconfidence,by(chose_gmo)
ttest gmoknowledge_three,by(chose_gmo)


//A8: Cohen's d
esize twosample gmoknowledge,by(fulltreatment)
esize twosample gmoknowledge,by(feedtreatment)
esize twosample overconfidence,by(fulltreatment)
esize twosample overconfidence,by(feedtreatment)


//A9 (NFC/Reflection analyses)
reg gmoknowledge full feed nfa full#c.nfa feed#c.nfa nfc full#c.nfc feed#c.nfc
reg gmoknowledge full feed nfa full#c.nfa feed#c.nfa nfc full#c.nfc feed#c.nfc age educ white party male income 
reg overconfidence full feed nfa full#c.nfa feed#c.nfa nfc full#c.nfc feed#c.nfc
reg overconfidence full feed nfa full#c.nfa feed#c.nfa nfc full#c.nfc feed#c.nfc age educ white party male income


//Figure A10 (Min / Max Reflection)
estsimp reg overconfidence full feed nfa nfc nfafull nfafeed nfcfull nfcfeed
//Control group predictions
//min reflection
setx feed 0 full 0 nfa max nfc min nfafull 0 nfafeed 0 nfcfull 0 nfcfeed 0
simqi, level (95)
//max reflection
setx feed 0 full 0 nfa min nfc max nfafull 0 nfafeed 0 nfcfull 0 nfcfeed 0 
simqi, level (95)
//Feed treatment predictions
//min reflection
setx feed 1 full 0 nfa max nfc min nfafull 0 nfafeed max nfcfull 0 nfcfeed min
simqi, level (95)
//max rflection
setx feed 1 full 0 nfa min nfc max nfafull 0 nfafeed min nfcfull 0 nfcfeed max
simqi, level (95)
//Full treatment predictions
//min reflection
setx feed 0 full 1 nfa max nfc min nfafull max nfafeed 0 nfcfull min nfcfeed 0 
simqi, level (95)
//max reflection
setx feed 0 full 1 nfa min nfc max nfafull min nfafeed 0 nfcfull max nfcfeed 0
simqi, level (95)
drop b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
drop in 991/1000
